import { useParams, useSearchParams, useLocation } from "react-router-dom";

export default function About() {
  const params = useParams();

  const [searchParams, setSearchParams] = useSearchParams();

  const location = useLocation();

  console.log("location", location);
  // console.log("params", params);
  // console.log("searchParams", searchParams);
  // console.log("getId", searchParams.get("id"));
  // console.log("getName", searchParams.get("name"));

  return (
    <div>
      <h2>About</h2>
      <button
        onClick={() =>
          setSearchParams((prev) => {
            console.log("prev", prev);
            prev.set("id", "300");

            return prev;
          })
        }
      >
        跳转
      </button>
    </div>
  );
}
